package cn.tx.shiro.service.impl;

import cn.tx.shiro.dao.RoleMapper;
import cn.tx.shiro.entity.Role;
import cn.tx.shiro.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 描述
 * @Author：XiaoBing
 * @Date：2020/11/2 17:42
 * @Version：1.0
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Resource
    private RoleMapper roleMapper;

    @Override
    public List<String> queryRoleByUserId(Integer userid) {
        List<Role> roleList = roleMapper.findRoleByUserId(userid);

        List<String> roles=new ArrayList<String>();
        for (Role role : roleList) {
            roles.add(role.getRolename());
        }
        return roles;
    }
}
